package cc.comac.mom.util.soaputil;

import java.util.Map;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

import com.alibaba.fastjson.JSON;

public class SoapCallUtil {
	
	private static  JaxWsDynamicClientFactory dcflient = JaxWsDynamicClientFactory.newInstance();

	
	public static Map<String,Object> invoke(String url,String method,String args) throws Exception {
		Client createClient = dcflient.createClient(url);
		Object[] invoke = createClient.invoke(method, args);
		String valueOf = String.valueOf(invoke[0]);
		@SuppressWarnings("unchecked")
		Map<String,Object> parseObject = JSON.parseObject(valueOf, Map.class);
		createClient.close();
		return parseObject;
	}
	
}
